import request from "@/utils/request";

// 获取用列表
export function reqUserList(page, limit, searchParams) {
  return request.get(`/admin/acl/user/${page}/${limit}`, {
    params: searchParams
  });
}

// 添加用户
export function reqAddUser(user) {
  return request.post("/admin/acl/user/save", user);
}

// 修改用户
export function reqUpdate(user) {
  return request.put("/admin/acl/user/update", user);
}

// 删除用户
export function reqRemoveUser(id) {
  return request.delete(`/admin/acl/user/remove/${id}`);
}

// 获取用户角色列表
export function reqRoleList(userId) {
  return request.get(`/admin/acl/user/toAssign/${userId}`);
}

// 用户角色授权
export function reqAssignRole(userId, roleId) {
  return request.post("/admin/acl/user/doAssign", null, {
    params: {
      userId,
      roleId
    }
  });
}

// 批量删除用户
export function reqRemoveUsers(ids) {
  return request.delete("/admin/acl/user/batchRemove", {
    data: ids
  });
}
